USE [aspnetdb]
GO

-- =============================================
-- Author     :		Lohith Ram D V
-- Create date:         08/mar/2011
-- Description:	Get CEO id for given dept.
-- =============================================

create procedure sp_GetCEOID(
@par_deptID nchar(100))
AS
Begin
select user1_name from User1 where User1_id in
((select user1_id from User1_Dept where dept_id = @par_deptID)
intersect
(select user1_id from User1 where role_id = 6))
end